﻿<Framework:SmartViewBase x:Class="SmartMusicBox.View.HomePageView"
                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                         xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         xmlns:Framework="clr-namespace:SmartMusicBox.Framework"
                         mc:Ignorable="d"
                         d:DesignWidth="480"
                         d:DesignHeight="768"
                         FontFamily="{StaticResource PhoneFontFamilyNormal}"
                         FontSize="{StaticResource PhoneFontSizeNormal}"
                         Foreground="{StaticResource PhoneForegroundBrush}"
                         SupportedOrientations="Portrait"
                         Orientation="Portrait"
                         shell:SystemTray.IsVisible="True"
                         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                         xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
                         xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                         xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                         DataContext="{Binding HomePage, Source={StaticResource Locator}}">

    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush Stretch="Fill"
                        ImageSource="../HomePage.jpg" />
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.78*" />
            <ColumnDefinition Width="0.22*" />
        </Grid.ColumnDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel"
                    Grid.Row="0"
                    Grid.Column="0"
                    Grid.ColumnSpan="2"
                    Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle"
                       Text="音乐随身听"
                       Style="{StaticResource PhoneTextNormalStyle}">
            	<TextBlock.Foreground>
            		<LinearGradientBrush EndPoint="0.5,1"
                                         StartPoint="0.5,0">
            			<GradientStop Color="#FFCE2B2B"
                                      Offset="0.103" />
            			<GradientStop Color="White"
                                      Offset="1" />
            		</LinearGradientBrush>
            	</TextBlock.Foreground>
            </TextBlock>
            <TextBlock x:Name="PageTitle"
                       Text="频道"
                       Margin="9,-7,0,0"
                       Style="{StaticResource PhoneTextTitle1Style}"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
            	<TextBlock.Foreground>
            		<LinearGradientBrush EndPoint="0.5,1"
                                         StartPoint="0.5,0">
            			<GradientStop Color="Black"
                                      Offset="0" />
            			<GradientStop Color="#FF97FDE3"
                                      Offset="1" />
            			<GradientStop Color="#FFBEEF40"
                                      Offset="0.168" />
            		</LinearGradientBrush>
            	</TextBlock.Foreground>
            </TextBlock>
        </StackPanel>
        <Grid x:Name="ContentPanel"
              Margin="12,0,0,0"
              Grid.Row="1"
              Grid.Column="0">
            <ListBox Grid.Row="0"
                     x:Name="ListPanel"
                     HorizontalAlignment="Left"
                     ItemsSource="{Binding Tiles}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <toolkit:HubTile Title="{Binding ChannelName}"
                                         Margin="1,1,1,1"
                                         Message="{Binding SongInfo}"
                                         Source="{Binding Picture}"
                                         Tag="{Binding SongData}"
                                         Background="{StaticResource PhoneAccentBrush}"
                                         Foreground="#FFFFFFFF"
                                         GroupTag="Channel"
                                         toolkit:TiltEffect.IsTiltEnabled="True">

                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Tap">
                                    <cmd:EventToCommand Command="{Binding OnTapCommand}"
                                                        CommandParameter="{Binding Title}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </toolkit:HubTile>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
        <Image Grid.Row="1"
               Grid.Column="1"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Width="48"
               Height="48"
               Margin="0,0,0,0"
               Visibility="{Binding ShowGoPlayerImage}"
               Source="../Images/arrow_right.png">

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Tap">
                    <cmd:EventToCommand Command="{Binding OnGoPlayerTapCommand}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
            
        </Image>
    </Grid>
</Framework:SmartViewBase>